import formBuilder from "@/comps/form/formBuilder";
import api from "./api";
import apiItemCategory from "@/pages/v1/wms/ItemCategory/js/apiItemCategory";
import apiUnit from "@/pages/v1/wms/Unit/js/apiUnit";
/*
fb.addText("name","名称",3)
fb.addText("category","分类",3)
fb.addText("unit","单位",3)
fb.addText("version","版本",3)

* */
export default {
    main:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)

        fb.addText("name","名称",3)
        fb.addCascade("categoryId","分类",3).setApi(apiItemCategory.urlTree)
        fb.addSelect("unitId","单位",3).setApi(apiUnit.urlChoice)
        fb.addText("version","版本",3).setTextTypeNumber()

        return fb
    },
    tree:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)

        fb.addCascade("parentId").setLabel("上级分类").setSpan(3)
            .setApi(api.urlTree)

        fb.addText("name").setSpan(6).setLabel("分类名称")
            .setRules([fb.R.notNull("名称不能为空")])

        fb.addText("sort").setSpan(3).setLabel("排序").setTypeNumber()
        return fb
    },
    other:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100).setLabelPosition("right")

        return fb
    }
}